package com.neo.push.server.connection;
import com.neo.push.core.connection.ConnectionFactory;
import com.neo.push.core.connection.ConnectionMonitor;
import com.neo.push.core.connection.SocketConnection;
import io.netty.channel.ChannelHandlerContext;

/**
 * Created by lock on 17-7-31.
 */
public class PushConnectionFactory implements ConnectionFactory {


    private PushMessageHandler pushMessageHandler;
    private ConnectionMonitor connectionMonitor;
    private int timeoutSeconds;

    @Override
    public SocketConnection instanceConnection(ChannelHandlerContext ctx) {
        return new PushConnection(timeoutSeconds,ctx,connectionMonitor,pushMessageHandler);
    }

    public void setPushMessageHandler(PushMessageHandler pushMessageHandler) {
        this.pushMessageHandler = pushMessageHandler;
    }

    public void setTimeoutSeconds(int timeoutSeconds) {
        this.timeoutSeconds = timeoutSeconds;
    }

    public void setConnectionMonitor(ConnectionMonitor connectionMonitor) {
        this.connectionMonitor = connectionMonitor;
    }
}
